import { createApp, App as AppType } from "vue";
import "./style.css";
import App from "./App.vue";
import { createPinia } from "pinia";
const pinia = createPinia();

// import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import MyGlobalComponent from "./components/globale/globalWs.vue";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import zhCn from "element-plus/es/locale/lang/zh-cn";
const app = createApp(App);
// 创建一个插件
const plugin = {
  install(app: AppType) {
    // 全局注册组件
    app.component("MyGlobalComponent", MyGlobalComponent);
  },
};

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

import router from "./router";

app
  .use(router)
  .use(ElementPlus, { locale: zhCn })
  .use(pinia)
  .use(plugin)
  .mount("#app");
